﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using ServBus.ListForm2010.Setup.Utilities;

namespace ServBus.ListForm2010.Setup.Commands
{
    class ClearTempCmd : BaseCommand
    {
        public override string Description
        {
            get { return Properties.Resources.CmdRemoveTemp; }
        }

        public override bool AllowRollback
        {
            get
            {
                return false;
            }
        }

        public override bool Execute()
        {
            try
            {
                Log.WriteLog(Log.LogType.Info, "Start Clearing...");
                File.Delete(Path.Combine(Constants.EXTRACTDIRECTORY, Constants.WSPNAME));
                Log.WriteLog(Log.LogType.Info, "Clear Finished.");
                return true;
            }
            catch
            {
                Log.WriteLog(Log.LogType.Error, "Clear Failed.");
                return false;
            }
        }

        public override bool Rollback()
        {
            return true;
        }
    }
}
